# coding=utf-8
"""
作者：董新强 
创建时间：
描述：
"""
from base_handler import BaseHandler
from framework.msg import failure
from services.params_estimation.param_eval_manage import ParamEvalManage


class AblilityHandler(BaseHandler):
    def http_get(self):
        pid = self.req_dict('id', int)
        if pid:
            return ParamEvalManage(self.usr).get_child_abilities(pid)
        return ParamEvalManage(self.usr).get_ability_list()


class ParamEvalStartTestHandler(BaseHandler):
    def http_post(self):
        aid = self.req_dict('aid', int)
        if not aid:
            return failure(msg='参数错误')

        return ParamEvalManage(self.usr).start_test(aid=aid)


class ParamEvalAnswerHandler(BaseHandler):
    def http_post(self):
        return ParamEvalManage(self.usr).to_answer(self.req_dict())
